package cn.scu.ne04jdemo.entitiy;

import cn.scu.ne04jdemo.util.SysCodeUtil;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.time.LocalDateTime;

@Data
@NoArgsConstructor
@Builder
@AllArgsConstructor
@ContentRowHeight(20)
@HeadRowHeight(35)
@ColumnWidth(20)
@TableName(value = "t_retroactive_earning_right")
public class RetroactiveEarningRight implements Serializable {
    @TableId(type = IdType.AUTO)
    @ExcelIgnore
    private Long id;
    @ExcelIgnore
    private String rightType;
    @TableField(exist = false)
    @ExcelProperty(value = "权属名", index = 0)
    private String rightTypeName;
    @ExcelProperty(value = "权利人", index = 1)
    private String userName;
    @ExcelProperty(value = "收益方", index = 2)
    private String department;
    @ExcelProperty(value = "数据集名称", index = 3)
    private String dataName;
    @ExcelProperty(value = "收益时间", index = 4)
    private String earningTime;
    @ExcelProperty(value = "累计收益", index = 5)
    private String earning;

    @TableField(fill = FieldFill.INSERT)
    @JsonIgnore
    @ExcelIgnore
    private LocalDateTime createDate;

    @TableField(fill = FieldFill.INSERT_UPDATE)
    @JsonIgnore
    @ExcelIgnore
    private LocalDateTime updateDate;

    public String getRightTypeName() {
        return SysCodeUtil.SysCodeMap.get(this.rightType);
    }
}
